<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=
    , initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <title>Document</title>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="(user,index) in userList" :key="user.id">
             {{++index}}  --- {{user.id}}--- {{user.username}}----{{user.password}}---{{user.age}}
            </li>
            <!-- 遍历对象，就能够有第三个参数，可以显示你的key值 -->
            <!-- <li v-for="(user,key,index) in userList[0]">
                {{user}}----{{key}} ---{{index}}
            </li> -->
        </ul>
    </div>
    <script>
        let vm = new Vue({
            el: "#app",
            data() {
                return {
                    userList: [
                       
                        {
                            id:2,
                            username: '李明',
                            password: '123456',
                            age: 21
                        },
                        {
                            id:1,
                            username: 'mayuhang',
                            password: '123456',
                            age: 18
                        },
                    ]
                }
            },
        });
    </script>
</body>

</html>